/*
 * @lc app=leetcode.cn id=283 lang=javascript
 *
 * [283] 移动零
 */

// @lc code=start
/**
 * @param {number[]} nums
 * @return {void} Do not return anything, modify nums in-place instead.
 */
var moveZeroes = function (nums) {
  let start = -1;
  let end = -1;
  let i = 0;

  while (i < nums.length) {
    if (nums[i] !== 0) {
      const temp = nums[i];
      nums[i] = nums[end + 1];
      nums[end + 1] = temp;
      end++;
    }
    i++;
  }
};
// @lc code=end
